#!/bin/sh
exec 2>&1
<%= render('mount_point_check.erb', cookbook: 'gitlab') %>
sleep <%= node['redis']['startup_delay'] %>
<% if @options[:open_files_ulimit] %>
ulimit -n <%= @options[:open_files_ulimit] %>
<% end %>
umask 077
exec chpst -P \
  -U <%= node['redis']['username'] %>:<%= node['redis']['group'] %> \
  -u <%= node['redis']['username'] %>:<%= node['redis']['group'] %> \
  /opt/gitlab/embedded/bin/redis-server \
  <%= File.join(node[@options[:service]]['dir'], "redis.conf") %><% if node['redis']['announce_ip_from_hostname'] %> \
  --replica-announce-ip "$(hostname -f)"<% end %>
